﻿//===============================================================================
// Microsoft Innovation Centre - Western Europe
// Copyright (c) 2008 Microsoft Corporation. All rights reserved.
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===============================================================================
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
//===============================================================================

using System;
using System.ComponentModel;
using System.Xml.Serialization;

namespace Microsoft.WVB.Framework
{
    [XmlRoot(ElementName = "Membership", IsNullable = false, Namespace = "http://dpewehq.microsoft.com/2008/06/WVB")]
    public class  MembershipUser : IMembershipUser, INotifyPropertyChanged
    {
        [XmlElement(ElementName = "username", IsNullable = false, Type = typeof(string), Namespace = "http://dpewehq.microsoft.com/2008/06/WVB")]
        public virtual string UserName 
        {
            get { return _UserName; }
            set { _UserName = value; OnPropertyChanged("UserName"); }
        }
        private string _UserName;

        [XmlElement(ElementName = "email", IsNullable = false, Type = typeof(string), Namespace = "http://dpewehq.microsoft.com/2008/06/WVB")]
        public virtual string Email
        {
            get { return _Email; }
            set { _Email = value; OnPropertyChanged("Email"); }
        }
        private string _Email;


        [XmlElement(ElementName = "providerName", IsNullable = false, Type = typeof(string), Namespace = "http://dpewehq.microsoft.com/2008/06/WVB")]
        public virtual string ProviderName
        {
            get { return _ProviderName; }
            set { _ProviderName = value; OnPropertyChanged("ProviderName"); }
        }
        private string _ProviderName;
        
        [XmlElement(ElementName = "creationDate", IsNullable = false, Type = typeof(DateTime?), Namespace = "http://dpewehq.microsoft.com/2008/06/WVB")]
        public virtual DateTime? CreationDate
        {
            get { return _CreationDate; }
            set { _CreationDate = value; OnPropertyChanged("CreationDate"); }
        }
        private DateTime? _CreationDate;

        [field: XmlIgnore]
        public event PropertyChangedEventHandler PropertyChanged;

        protected void OnPropertyChanged(string property)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(property));
            }
        }
    }
}
